<!DOCTYPE html>
<html lang="zh-cn">
    <head><meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'><meta name='description' content='如何在Linux服务器上使用ASF挂卡'><title>从零开始ASF挂卡</title>

<link rel='canonical' href='https://luobo.cf/p/asf/'>

<link rel="stylesheet" href="/scss/style.min.css"><meta property='og:title' content='从零开始ASF挂卡'>
<meta property='og:description' content='如何在Linux服务器上使用ASF挂卡'>
<meta property='og:url' content='https://luobo.cf/p/asf/'>
<meta property='og:site_name' content='luoboQAQ'>
<meta property='og:type' content='article'><meta property='article:section' content='Post' /><meta property='article:tag' content='ASF' /><meta property='article:tag' content='教程' /><meta property='article:published_time' content='2021-08-11T21:46:24&#43;08:00'/><meta property='article:modified_time' content='2021-08-11T21:46:24&#43;08:00'/><meta property='og:image' content='https://luobo.cf/p/asf/82970659.jpg' />
<meta name="twitter:title" content="从零开始ASF挂卡">
<meta name="twitter:description" content="如何在Linux服务器上使用ASF挂卡"><meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content='https://luobo.cf/p/asf/82970659.jpg' />
    </head>
    <body class="
    article-page has-toc
">
    <script>
        (function() {
            const colorSchemeKey = 'StackColorScheme';
            if(!localStorage.getItem(colorSchemeKey)){
                localStorage.setItem(colorSchemeKey, "auto");
            }
        })();
    </script><script>
    (function() {
        const colorSchemeKey = 'StackColorScheme';
        const colorSchemeItem = localStorage.getItem(colorSchemeKey);
        const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;

        if (colorSchemeItem == 'dark' || colorSchemeItem === 'auto' && supportDarkMode) {
            

            document.documentElement.dataset.scheme = 'dark';
        } else {
            document.documentElement.dataset.scheme = 'light';
        }
    })();
</script>
<div class="container main-container flex 
    
        extended
    
">
    
        <div id="article-toolbar">
            <a href="https://luobo.cf" class="back-home">
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-left" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <polyline points="15 6 9 12 15 18" />
</svg>



                <span>返回</span>
            </a>
        </div>
    
<main class="main full-width">
    <article class="has-image main-article">
    <header class="article-header">
        <div class="article-image">
            <a href="/p/asf/">
                <img src="/p/asf/82970659_hu38fcc35bf47ad0f09aab60914ff90ed7_427280_800x0_resize_q75_box.jpg"
                        srcset="/p/asf/82970659_hu38fcc35bf47ad0f09aab60914ff90ed7_427280_800x0_resize_q75_box.jpg 800w, /p/asf/82970659_hu38fcc35bf47ad0f09aab60914ff90ed7_427280_1600x0_resize_q75_box.jpg 1600w"
                        width="800" 
                        height="565" 
                        loading="lazy"
                        alt="Featured image of post 从零开始ASF挂卡" />
                
            </a>
        </div>
    

    <div class="article-details">
    

    <h2 class="article-title">
        <a href="/p/asf/">从零开始ASF挂卡</a>
    </h2>

    
    <h3 class="article-subtitle">
        如何在Linux服务器上使用ASF挂卡
    </h3>
    

    
    <footer class="article-time">
        
            <div>
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-calendar-time" width="56" height="56" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <path d="M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4" />
  <circle cx="18" cy="18" r="4" />
  <path d="M15 3v4" />
  <path d="M7 3v4" />
  <path d="M3 11h16" />
  <path d="M18 16.496v1.504l1 1" />
</svg>
                <time class="article-time--published">Aug 11, 2021</time>
            </div>
        

        
            <div>
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <circle cx="12" cy="12" r="9" />
  <polyline points="12 7 12 12 15 15" />
</svg>



                <time class="article-time--reading">
                    阅读时长: 1 分钟
                </time>
            </div>
        
    </footer>
    
</div>
</header>

    <section class="article-content">
    <p>因为买了一台云服务器，不拿来干点啥实在是太亏了，于是便想到了可以使用云服务器来挂卡。</p>
<h2 id="步骤">步骤</h2>
<h3 id="安装net环境">安装.net环境</h3>
<p>ASF是基于.netcore开发的程序，所以需要安装环境。这里建议看微软官方的<a class="link" href="https://docs.microsoft.com/zh-cn/dotnet/core/install/"  target="_blank" rel="noopener"
    >安装文档</a>，里面有不同系统的安装方法。</p>
<p>我们需要安装的只是ASP.NET Core 运行时。</p>
<p>我的系统是centos7，这里就只列举我系统上的命令了。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh">sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install aspnetcore-runtime-5.0
</code></pre></div><h3 id="安装asf">安装ASF</h3>
<p>在<a class="link" href="https://github.com/JustArchiNET/ArchiSteamFarm/releases/latest"  target="_blank" rel="noopener"
    >ASF的发布页面</a>上下载系统对应的版本解压即可。</p>
<p>我这里是在本地先下载好后用WinSCP直接传上服务器。</p>
<h3 id="配置asf">配置ASF</h3>
<p>这里就采用官方的**<a class="link" href="https://justarchinet.github.io/ASF-WebConfigGenerator"  target="_blank" rel="noopener"
    >在线配置文件生成器</a>**自动生成即可。</p>
<p>我们这里选择<code>机器人</code>，将steam的账号和密码填入，并将Enabled设置为True就行了。</p>
<p>详细的配置内容可以在<a class="link" href="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Configuration-zh-CN"  target="_blank" rel="noopener"
    >官方Wiki</a>上看到，这里就不再赘述了。</p>
<p>下面放上我的配置文件：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="p">{</span>
  <span class="nt">&#34;SteamLogin&#34;</span><span class="p">:</span> <span class="s2">&#34;xxx&#34;</span><span class="p">,</span>
  <span class="nt">&#34;SteamPassword&#34;</span><span class="p">:</span> <span class="s2">&#34;xxx&#34;</span><span class="p">,</span>
  <span class="nt">&#34;Enabled&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
  <span class="nt">&#34;CustomGamePlayedWhileFarming&#34;</span><span class="p">:</span> <span class="s2">&#34;挂卡中...&#34;</span><span class="p">,</span>
  <span class="nt">&#34;CustomGamePlayedWhileIdle&#34;</span><span class="p">:</span> <span class="s2">&#34;空闲中...&#34;</span><span class="p">,</span>
  <span class="nt">&#34;FarmingOrders&#34;</span><span class="p">:</span> <span class="p">[</span>
    <span class="mi">15</span><span class="p">,</span>
    <span class="mi">12</span>
  <span class="p">],</span>
  <span class="nt">&#34;HoursUntilCardDrops&#34;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  <span class="nt">&#34;OnlineStatus&#34;</span><span class="p">:</span> <span class="mi">1</span>
<span class="p">}</span>
</code></pre></div><ul>
<li><code>CustomGamePlayedWhileFarming</code>：表示挂卡时显示的游戏名</li>
<li><code>CustomGamePlayedWhileIdle</code>：表示空闲时显示的游戏名</li>
<li><code>HoursUntilCardDrops</code>：表示至少将游戏挂到几小时，如果是非限制账户，调到0是最好的。</li>
</ul>
<p>我们也可以配置ASF本身的设置，这里也同样贴上我的配置：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="p">{</span>
  <span class="nt">&#34;s_SteamOwnerID&#34;</span><span class="p">:</span> <span class="s2">&#34;xxx&#34;</span><span class="p">,</span>
  <span class="nt">&#34;CurrentCulture&#34;</span><span class="p">:</span> <span class="s2">&#34;zh-CN&#34;</span><span class="p">,</span>
  <span class="nt">&#34;IPCPassword&#34;</span><span class="p">:</span> <span class="s2">&#34;xxx&#34;</span>
<span class="p">}</span>
</code></pre></div><ul>
<li><code>s_SteamOwnerID</code>：该属性定义 ASF 进程所有者的 64 位 Steam ID，直接设置成自己的大号就行</li>
<li><code>CurrentCulture</code>：ASF的语言</li>
<li><code>IPCPassword</code>：由于ASF默认会开启IPC服务，为了安全起见建议设置密码或关闭IPC服务。</li>
</ul>
<p>将配置文件放入<code>config</code>目录里就行了。</p>
<h3 id="启动asf">启动ASF</h3>
<p>首先将ASF的主程序设置为可执行：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh">sudo chmod <span class="m">755</span> ./ArchiSteamFarm
</code></pre></div><p>然后运行即可：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh">./ArchiSteamFarm
</code></pre></div><h2 id="附加步骤">附加步骤</h2>
<h3 id="使用ascf">使用ASCF</h3>
<p>由于服务器在大陆境内，由于众所周知的原因是无法访问steam社区的，这时就需要使用大佬开发的转发工具了。</p>
<p><a class="link" href="https://keylol.com/t339641-1-1"  target="_blank" rel="noopener"
    >【更新2.0】另一个SteamCommunityFix | 支持Win/Linux/MacOS 【2018-08-29】</a></p>
<p>下载地址：https://pan.baidu.com/s/1nvBW8qP</p>
<p><strong>使用步骤：</strong></p>
<ul>
<li>
<p>下载并解压缩</p>
</li>
<li>
<p>打开终端（Terminal），进入到ascf程序目录：
如ascf程序在 /Users/Makazeu/Downloads/文件夹中，那么在终端中输入</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="nb">cd</span> /Users/Makazeu/Downloads
</code></pre></div></li>
<li>
<p>赋予程序可执行权限，在终端中输入命令：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"> chmod +x ./ascf
</code></pre></div></li>
<li>
<p>使用root用户（管理员用户）运行程序，在终端中输入</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"> sudo ./ascf
</code></pre></div><p>输入root用户密码后，看程序是否运行
因为程序涉及到hosts文件修改，需要高权限，所以你需要输入root密码</p>
</li>
<li>
<p>若程序已经成功运行，此时就不要关闭终端窗口了，否则程序就会退出！试下Steam社区能否正常打开</p>
</li>
</ul>
<h3 id="使用tmux">使用Tmux</h3>
<p>由于我们在服务器上使用，不可能一直开着ssh，这时就需要将终端窗口和会话解绑，Tmux就是做这个工作的。</p>
<p><strong>安装：</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="c1"># Ubuntu 或 Debian</span>
$ sudo apt-get install tmux

<span class="c1"># CentOS 或 Fedora</span>
$ sudo yum install tmux

<span class="c1"># Mac</span>
$ brew install tmux
</code></pre></div><p><strong>常用命令/快捷键：</strong></p>
<ul>
<li>
<p>新建会话：Tmux 窗口默认是以0、1、2&hellip;&hellip;来编号的，为了便于区分，可以为每个会话起名</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh">tmux new -s &lt;session-name&gt;
</code></pre></div></li>
<li>
<p>分离当前会话：<code>Ctrl+b d</code></p>
</li>
<li>
<p>列出所有会话：<code>Ctrl+b s</code>或<code>tmux ls</code></p>
</li>
<li>
<p>重命名当前会话：<code>Ctrl+b $</code>或<code>tmux rename-session -t 0 &lt;new-name&gt;</code></p>
</li>
<li>
<p>接入到某个会话：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="c1"># 使用会话编号</span>
$ tmux attach -t <span class="m">0</span>

<span class="c1"># 使用会话名称</span>
$ tmux attach -t &lt;session-name&gt;
</code></pre></div></li>
<li>
<p>切换到某个会话：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="c1"># 使用会话编号</span>
$ tmux switch -t <span class="m">0</span>

<span class="c1"># 使用会话名称</span>
$ tmux switch -t &lt;session-name&gt;
</code></pre></div></li>
</ul>
<h2 id="参考链接">参考链接</h2>
<ul>
<li><a class="link" href="http://www.ruanyifeng.com/blog/2019/10/tmux.html"  target="_blank" rel="noopener"
    >Tmux 使用教程 - 阮一峰的网络日志</a></li>
<li><a class="link" href="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Configuration-zh-CN"  target="_blank" rel="noopener"
    >ASF官方Wiki</a></li>
<li><a class="link" href="https://docs.microsoft.com/zh-cn/dotnet/fundamentals/"  target="_blank" rel="noopener"
    >NET开发文档</a></li>
</ul>

</section>


    <footer class="article-footer">
    
    <section class="article-tags">
        
            <a href="/tags/asf/">ASF</a>
        
            <a href="/tags/%E6%95%99%E7%A8%8B/">教程</a>
        
    </section>


    
    <section class="article-copyright">
        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copyright" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <circle cx="12" cy="12" r="9" />
  <path d="M14.5 9a3.5 4 0 1 0 0 6" />
</svg>



        <span>Licensed under CC BY-NC-SA 4.0</span>
    </section>
    </footer>


    
</article>

    <aside class="related-contents--wrapper">
    
    
</aside>

     
     
        
    

    <footer class="site-footer">
    <section class="copyright">
        &copy; 
        
            2020 - 
        
        2021 luoboQAQ
    </section>
    
    <section class="powerby">
        Built with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> <br />
        Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="3.0.0">Stack</a></b> designed by <a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>
    </section>
</footer>

    
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    
    <div class="pswp__bg"></div>

    
    <div class="pswp__scroll-wrap">

        
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                
                
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div><script 
                src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"integrity="sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo="crossorigin="anonymous"
                defer="true"
                >
            </script><script 
                src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"integrity="sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU="crossorigin="anonymous"
                defer="true"
                >
            </script><link 
                rel="stylesheet" 
                href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css"integrity="sha256-c0uckgykQ9v5k&#43;IqViZOZKc47Jn7KQil4/MP3ySA3F8="crossorigin="anonymous"
            ><link 
                rel="stylesheet" 
                href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.css"integrity="sha256-SBLU4vv6CA6lHsZ1XyTdhyjJxCjPif/TRkjnsyGAGnE="crossorigin="anonymous"
            >

            </main>
    
        <aside class="sidebar right-sidebar sticky">
            <section class="widget archives">
                <div class="widget-icon">
                    <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <line x1="5" y1="9" x2="19" y2="9" />
  <line x1="5" y1="15" x2="19" y2="15" />
  <line x1="11" y1="4" x2="7" y2="20" />
  <line x1="17" y1="4" x2="13" y2="20" />
</svg>



                </div>
                <h2 class="widget-title section-title">目录</h2>
                
                <div class="widget--toc">
                    <nav id="TableOfContents">
  <ol>
    <li><a href="#步骤">步骤</a>
      <ol>
        <li><a href="#安装net环境">安装.net环境</a></li>
        <li><a href="#安装asf">安装ASF</a></li>
        <li><a href="#配置asf">配置ASF</a></li>
        <li><a href="#启动asf">启动ASF</a></li>
      </ol>
    </li>
    <li><a href="#附加步骤">附加步骤</a>
      <ol>
        <li><a href="#使用ascf">使用ASCF</a></li>
        <li><a href="#使用tmux">使用Tmux</a></li>
      </ol>
    </li>
    <li><a href="#参考链接">参考链接</a></li>
  </ol>
</nav>
                </div>
            </section>
        </aside>
    

        </div>
        <script 
                src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js"integrity="sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g="crossorigin="anonymous"
                defer="false"
                >
            </script><script type="text/javascript" src="/ts/main.js" defer></script>
<script>
    (function () {
        const customFont = document.createElement('link');
        customFont.href = "https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap";

        customFont.type = "text/css";
        customFont.rel = "stylesheet";

        document.head.appendChild(customFont);
    }());
</script>

    </body>
</html>
